package com.sushengren.easyword;

import com.sushengren.easyword.DemoData.ClassInfo;
import com.sushengren.easyword.DemoData.StudentInfo;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * @author sushengren
 */
public class Ber {

    private final static String CLASS_LOGO = "iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAAAXNSR0IArs4c6QAABNRJREFUSEu9lntM1XUYxj+Hu4JoXOSi3JKy7OaaZU3barkiXa5atZUzS8WSBpldBCppmaU0QxNzjdUca2om3baWa15SC1rNtaZZZmHpHwIRKHfk1p7z8ts5wIFz4I/ejbFzzu/3Pt/3eZ/3eb+uvr6+PsYY3V3Q3gERERAaOrokrrECNzZAbS0EBUFvL8TGQXx84OBjBv7tVwgJAZcLxFlPD0RHQ1LyUHD9rue8Y1TALc3Q0mpJmi5atd4hcFE+cRL09kBrG3R22MHCwyEtAxz8gIHr/4H6equyrRUaGiE11WAHqKQPevtV412l2jF+PExNsXf8Ajc0QGgINDVBV5f1s7nZDhEcDMnJEBZm4Pq7dAl6uiE8whhxDuVuRy9Mn+4HuLYGclfAubNG7eWZULAWYuLgj9PWU/fJXUajPjsHc1hISoSIcZ5Dia30DD/A8+aCxmXWzdDeDieO29g88wJMTuyvpA/UAiWcFAPtbcaIIzhVmZ5u33V3m/AkwGGp3r8P1hbAI4shd7U9uGkjfP4JRITDzBtNZH9VQ0eHmmyMLFnuqU6gAnR0oByZV3ik6LPHH+6AbZuhZBvcMscAIqPg4H7Y/o4lVEjBV82Af+ut8sQkeDYfpH4Bq8cpKVZt9ERISPADvLUEdpfD1jKIn2xVKYmoFo2/n4LISMiYZgDjxsGqHDh9ClbnQ0ys9TsuDqKirP8TJtjBnPBZ8cMLoaYGSsvsxQHj4oKQYI9pKNGEaNi+BQ4dgBVPQ2q6VZmWZuw4tF/Zr+ghPf76K9j8FrS2wqzZsOZlaG4aaBKDP4kBsbH8MTOHdcXGkNgRtU5b9D8qEpKmDBJX9mI4+YvN5rwsyM6BtjYTzkghmvfuhk/3wu13Qta9pm6xIrNwxk5Vi4VpmaYNN9WlJbBnJ8y4Foq3WH+0BAb7q68DqBXP5UFdDeQXWVIZhSwzUXMc4WmVDhEXDzEx/cAPzDegQ99baq26s2fAFWQ0jnQAN3Cubar8VyAs3NNXvadxcvqsilPTzDrdFS96EM79DQcqPXtV1MgWLzTaidUCXyFn+qICPtoF190Aj2fbAnEEpeqkaEfZU6Z69VjGsHEdXBZjprFIQvHaPFK4kg0HrqqfWmqsrcyz2VZV7sUQCbGxEBxk/j1knMrehfIP7GG3SlfCkmWeB6v/9Njh4Mrl1cd/hg2vw02z4cVCWySy3JR+aodMg/cNpLMTPt4F5e/bi29uMqUq6urg4gU7lAQUoqtOvy3qO22xnGVGd2GRbTMZiAzIV/g0EFng/ffA1dfAezvsNR2k5rxZ3w9VNnqqVIm1GneWw8kTUPgqLFg48ggOMRDvx+/Lsr4erLJv1QJVveE1+OmYqde9Y7tsB+v3W+fC26X+QUcEXrMKjh6Gii8996iiQjjyjc2hc5PQ/4REuH6mba1AY9gbiHz3pedhaio8kQ2VR+Hbw+bL2tHqsyrWstCOHm2MePXRiFXsMftTxE2Gz/bB+iLPRa+lBXLyTL2jCb93Ll2Bjv1oItKoKLRMVL3sUPaakgpLnxwNbACXPV/pJKaiAluZbsU3QdEbtpcDDb8VD5dIs36m2nqtNTjnNrh7QaCwY6xY6WvPQ/F6s9nWFrhrPtwx738AFkTVd1B5xDbOQ48GDqon/wNR5D7FSNqgLAAAAABJRU5ErkJggg==";

    public static void main(String[] args) throws IOException {

        List<StudentInfo> student1List = new ArrayList<>();
        student1List.add(new StudentInfo("小明", "No01001", 280.0, 93.3, 1, 1, ""));
        student1List.add(new StudentInfo("小红", "No01002", 260.0, 86.6, 2, 2, ""));
        student1List.add(new StudentInfo("小花", "No01003", 270.0, 90.0, 3, 120, ""));
        student1List.add(new StudentInfo("小莉", "No01004", 250.0, 83.3, 4, 210, ""));
        student1List.add(new StudentInfo("托尼", "No01005", 241.0, 80.3, 5, 600, ""));

        List<StudentInfo> student2List = new ArrayList<>();
        student2List.add(new StudentInfo("小明2", "No02001", 280.0, 93.3, 1, 1, ""));
        student2List.add(new StudentInfo("小红2", "No02002", 260.0, 86.6, 2, 2, ""));
        student2List.add(new StudentInfo("小花2", "No02003", 270.0, 90.0, 3, 120, ""));
        student2List.add(new StudentInfo("小莉2", "No02004", 250.0, 83.3, 4, 210, ""));
        student2List.add(new StudentInfo("托尼2", "No02005", 241.0, 80.3, 5, 600, ""));

        List<StudentInfo> student3List = new ArrayList<>();
        student3List.add(new StudentInfo("小明3", "No03001", 280.0, 93.3, 1, 1, ""));
        student3List.add(new StudentInfo("小红3", "No03002", 260.0, 86.6, 2, 2, ""));
        student3List.add(new StudentInfo("小花3", "No03003", 270.0, 90.0, 3, 120, ""));
        student3List.add(new StudentInfo("小莉3", "No03004", 250.0, 83.3, 4, 210, ""));
        student3List.add(new StudentInfo("托尼3", "No03005", 241.0, 80.3, 5, 600, ""));

        List<StudentInfo> student4List = new ArrayList<>();
        student4List.add(new StudentInfo("小明4", "No04001", 280.0, 93.3, 1, 1, ""));
        student4List.add(new StudentInfo("小红4", "No04002", 260.0, 86.6, 2, 2, ""));
        student4List.add(new StudentInfo("小花4", "No04003", 270.0, 90.0, 3, 120, ""));
        student4List.add(new StudentInfo("小莉4", "No04004", 250.0, 83.3, 4, 210, ""));
        student4List.add(new StudentInfo("托尼4", "No04005", 241.0, 80.3, 5, 600, ""));


        List<ClassInfo> classList = new ArrayList<>();
        classList.add(new ClassInfo("一年级一班", 50, 270.5, "一年级", 1, "温娟", CLASS_LOGO, student1List));
        classList.add(new ClassInfo("一年级二班", 60, 260.5, "一年级", 2, "张三", CLASS_LOGO, student2List));
        classList.add(new ClassInfo("一年级三班", 35, 280.5, "一年级", 3, "李四", CLASS_LOGO, student3List));
        classList.add(new ClassInfo("一年级四班", 56, 290.5, "一年级", 4, "王五", CLASS_LOGO, student4List));

        DemoData data = DemoData.builder()
                .title("2022年度期末考试成绩报告")
                .generationTime("2022-01-01")
                .numberOfStudents(1510)
                .numberOfInvigilators(157)
                .numberOfTeachers(157)
                .year("二零二二")
                .semester("第二学期")
                .examinationTime("2022-10-01 至 2022-10-02")
                .subject("语文、数学、英语")
                .classList(classList)
                .logo(new FileInputStream("C:\\Users\\mangfu\\Pictures\\logo.png"))
                .build();

        File file = new File("C:\\Users\\mangfu\\Desktop\\期末成绩报告模板.docx");
        FileOutputStream out = new FileOutputStream("C:\\Users\\mangfu\\Desktop\\期末成绩报告-1.docx");
        EasyWord.of(file).doWrite(data).toOutputStream(out);
    }

}
